import {collectGoods} from '@/api/goods'

import { showToast } from 'vant';
export default function(goodsId,isCollect){
	
	
	function Collect(){
		let type = isCollect.value?2:1;
		collectGoods({
			goods_id:goodsId,
			type:type
		}).then(res=>{
			console.log(res)
			showToast(res.msg)
			if(res.code === 0){
				isCollect.value = res.isCollect
			}
			
		})
	}
	
	return {
		Collect
	}
}